from typing import Iterable, Iterator, Any


class DataObject:
    key: str
    size: int
    label: str

    def __enter__(self) -> DataObject: ...
    def __exit__(self, exc_type, exc_val, exc_tb): ...
    def tell(self) -> int: ...
    def seek(self, offset: int, whence: int) -> int: ...
    def read(self, count: int) -> bytes: ...
    def readinto(self, buf) -> int: ...
    def write(self, data) -> int: ...
    def close(self) -> int: ...
    def flush(self) -> int: ...
    def err(self) -> int: ...
    def error_msg(self) -> str: ...
    def copy(self) -> DataObject: ...


class DataSet:
    def list(self, bucket: str, prefix: str) -> Iterator[DataObject]: ...
    def list_with_preload(self, bucket: str, prefix: str) -> Iterator[DataObject]: ...
    def list_from_uris(self, iter: Iterable, prefetch: bool, include_errors: bool) -> Iterator[DataObject]: ...
    def list_from_uris_with_preload(self, iter: Iterable) -> Iterator[DataObject]: ...
    def list_from_tar(self, bucket: str, tar_key: str, index_key: str, chunks: Iterable, sizes: Iterable,
                      prefetch: bool, include_errors: bool) -> Iterator[DataObject]: ...
    def open_ro(self, bucket: str, key: str, size: int, mmap: int, label: str) -> DataObject: ...
    def open_wo(self, bucket: str, key: str) -> DataObject: ...
    def gen_tar_archive(self, tar_path: str, index_path: str, source_path: str, index_only: bool) -> int: ...


def new_oss_dataset(endpoint: str, cred_path: str, cred_provider: Any, config_path: str, uuid: str, id: int, total: int) -> DataSet:
    ...


def new_data_object(key: str, size: int, label: str) -> DataObject:
    ...
